var sysParam = {};
var sysParam = function () {
    //本身
    var $this = this;
    this.init = function () {
        //实例化表格
        layuiFunciton.tableInit({
            tableId: 'modelTableId',
            url: '/ngu/goods/selectGoodsList',
            id: 'modelId',
            searchFromId: 'searchFrom',
            tableFilter: 'modelList', //表格监听名称,
            page: true,
            cols: [[
                {
                    field: 'name',
                    title: '购买人姓名',
                    align: "rigth"
                },
                {
                field: 'phone',
                title: '购买人电话',
                align: "rigth",
                sort: true
                },
                {
                field: 'address',
                title: '住址',
                align: "rigth",
                sort: true
                }
                ,{
                field: 'goods',
                title: '物品描述',
                align: "rigth",
                sort: true
                },
                {
                field: 'createTime',
                title: '创建时间',
                align: "rigth",
                sort: true
                },
                {
                field: 'updateTime',
                title: '修改时间',
                align: "rigth",
                sort: true,
                templet: function (d) {
                    if (d.updateTime == "" || d.updateTime == null) {
                        return "<span>-</span>";
                    }
                    return d.updateTime;
                }
                },
                {
                title: '操作',
                align: "center",
                width: 150,
                templet: '#modelBar',
                fixed: 'right'
                }

                ]
            ],

            tools: {
                del: {
                    returnData: function (rowData) {
                        layer.confirm('您确定要删除<span style="color: red">“'+(rowData.name.length<=5 ?rowData.name : rowData.name.substring(0,5)+"...")+'”</span>这条数据吗?', {
                            icon: 3,
                            title: '提示信息'
                        }, function (index) {
                            layuiFunciton.ajaxRequest({
                                url: '/ngu/goods/delGoods',
                                method: 'post',
                                data: {
                                    id: rowData.id,
                                    delFlag:1
                                },
                                success: function (data) {
                                    console.log(data)
                                    if (data == 1) {
                                        layuiFunciton.success("操作成功！", function () {
                                            layer.close(index);
                                            layuiFunciton.refresh('searchFrom', 'modelId');
                                        });
                                    }

                                }
                            })
                        });
                    }
                }
            }
        });


    }
    //搜索
    this.find = function () {
        $("#search_btn").click(function () {
            layuiFunciton.refresh('searchFrom', 'modelId', 1);
        });
    }




}
$(function () {
    sysParam = new sysParam();
    sysParam.init(); //初始化
    sysParam.find(); //绑定事件
})
